package zlx.springcloud.control;


import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import zlx.springcloud.domain.CommonResult;
import zlx.springcloud.service.StorageService;

import javax.annotation.Resource;

@RestController
public class StorageController {
    /**
     * 扣减库存
     */
    @Resource
    private StorageService storageService;
    @PostMapping(value = "/storage/decrease")
    public CommonResult decrease(@RequestParam("productId") Long productId,@RequestParam("count") Integer count){
        storageService.desrease(productId,count);
        return new CommonResult(200,"扣减库存成功");
    }
}
